// JavaScript Document Contains Library Function written By Vaibhav Shetye for code2infinity

// Version: 1


//	Function to return the id of the element when user clicks on it
function whichElement()
{
	var e=window.event;    // Catch event		
  	var targ = e.target;  // get object of the elment -- target is a javascript method
   	return targ;         // return object to the calling function
}

// ----------------------------- Table Detect Functions ---------------------------------------------

// Function returns the row number of the currently selected task
function whichRow()
{
	targ = whichElement();
	row = targ.parentNode.parentNode.rowIndex;
	return row;
}

// Function returns the column number of the currently selected cell
function whichCol()
{
	targ = whichElement();
	col = targ.parentNode.cellIndex;
	return col;
}

// Function returns the id of the currently selected cell
function getColId()
{
	targ = whichElement();
	val = targ.parentNode.id;
	return val;
}

// Function returns the id of the currently selected row
function getRowId()
{
	targ = whichElement();
	val = targ.parentNode.parentNode.id;
	return val;
}

//--------------------------------------- Key Detect functions ----------------------------------------------

// Function to get which key was pressed
function whichKey(e)
{
    return e.keyCode;
}
